<!DOCTYPE html>
<html>

<head>
  <meta charset="utf-8" />
  <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no, viewport-fit=cover" />
  <meta name="HandheldFriendly" content="true" />
  <meta name="MobileOptimized" content="320" />
  <title>Hello H5+</title>
  <!-- <script type="text/javascript" src="../js/common.js"></script> -->



  <script type="text/javascript">
    document.addEventListener("plusready", onPlusReady, false)
    function onPlusReady() {
      alert("111111")
      show("ready")
    }

    function show(t) {
      let dom = document.getElementById("text")
      dom.value = t
    }

    var scan = null;
    function onmarked(type, result) {
      var text = '未知'
      switch (type) {
        case plus.barcode.QR:
          text = "QR: "
          break
        case plus.barcode.EAN13:
          text = "EAN13: "
          break
        case plus.barcode.EAN8:
          text = "EAN8: "
          break
      }
      alert(text + result)
    }

    function startRecongnize() {
      scan = new plus.Barcode('bcid')
      scan.onmarked = onmarked
    }

    function startScan() {
      show("1111111111111")
      scan.start()
    }




  </script>

<body style="background-color:#000000;">

  <input type='button' onclick="startRecongnize()" value="创建控件"> </input>
  <input type='button' onclick="startScan()" value="开始扫描"> </input>
  <input type='button' onclick="cancelScan()" value="取消扫描"> </input>
  <input type='button' onclick="setFlash()" value="开启闪光灯"> </input>
  <div id="bcid">
  </div>
  <input type="text" id="text"></input>
</body>
<style>
  #bcid {
    background: #EEE;
    height: 480px;
    width: 360px;
  }
</style>

</html>